package jj;
import javax.swing.text.TabStop;
public class Zhan {
private  int top = 0;

private  String[] stackArr=  new String[5];


public void push(String num){
    stackArr[top] = num;
    top++;
}


//出栈
public void out(){
     String item = stackArr[top];
     System.out.println("出栈的数据"+item);
     stackArr[top-1] =null;
     top--;
}


public void printStackArr(){
    for (int i = 0; i < stackArr.length; i++) {
        String item = stackArr[i];
        if(item==null){
            break;
        }
        System.out.println(item+"");
    }
    System.out.println();

}

public void clear(){
while (top>0){
    out();
}

}
}
